﻿@using Top.Api.Response;
@using HuiJiYunGo.EF;
@{
    ViewBag.Title = "惠集云GO，优惠云集";
    Layout = "~/Views/Shared/_LayoutMobile.cshtml";
    //var MaterialList = ViewBag.MaterialList as List<TbkDgOptimusMaterialResponse.MapDataDomain>;//商品集合
    //var CategoryTop10List = ViewBag.CategoryTop10List as List<CategoryLevelOneViewModel>;
    var SlideShowList = ViewBag.SlideShowList as List<SlideShow>;//轮播图
    var AppBarMobileList = ViewBag.AppBarMobileList as List<AppBarViewModel>;
    var AdvertList = ViewBag.AdvertList as List<Advert>;//广告位 每20个商品 出现一个广告位
    string AdminSite = ViewBag.AdminSite;
}

<style>

    .jq22-good-list a {
        background-color: rgba(239, 46, 46, 0.06);
        border-radius: 6px;
        margin-top: 10px;
        margin-left: 8px;
        margin-right: 8px;
    }

    .btn-buy {
        width: 5.6rem;
        height: 2.68rem;
        background: linear-gradient(90deg,#ff5d6a,#fb86ef) !important;
        box-shadow: 0 0.04rem 0.06rem 0 rgba(235,73,251,.25);
        border-radius: 2rem .04rem .04rem 2rem;
        position: absolute;
        bottom: .24rem;
        right: -.08rem;
        border: 1px solid transparent;
        z-index: 1;
        padding-left: .28rem;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-flex-direction: column;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-justify-content: center;
        -ms-flex-pack: center;
        justify-content: center;
    }

    .tobuy {
        font-size: .24rem;
        font-family: PingFangSC-Medium,PingFang SC;
        font-weight: 500;
        color: #fff;
        top: 5px;
        position: relative;
    }

    .btn-buy span {
        color: #ffffff;
        background-color: rgba(255, 255, 255, 0);
    }

        .btn-buy span:last-child {
            font-size: .24rem;
            font-family: PingFangSC-Medium,PingFang SC;
            font-weight: 500;
            color: #fff;
        }

    .jq22-flex-box h3 {
        font-size: 1.1rem;
    }

    .jq22-flex-box span {
        text-align: center;
        border-radius: 2px;
        font-size: 0.7rem;
        /*padding: 0.1rem 0.3rem;*/
    }
</style>


@*<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>@ViewBag.Title</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
        <meta content="yes" name="apple-mobile-web-app-capable" />
        <meta content="black" name="apple-mobile-web-app-status-bar-style" />
        <meta content="telephone=no" name="format-detection" />
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <link href="~/Content/mobile/style.css" rel="stylesheet" />
    </head>
    <body>*@

<section class="jq22-flexView" style="height:100%;">
    @*<header class="jq22-navBar jq22-navBar-fixed">
            <a href="javascript:;" class="jq22-navBar-item">
                分类
            </a>
            <div class="jq22-center">
                <div class="jq22-search-box">
                    <i class="icon icon-search"></i>
                    <form action="/Mobile/Search">
                        <input type="search" name="Key" placeholder="手机">
                    </form>
                </div>
            </div>
            <a href="javascript:;" class="jq22-navBar-item">
                <i class="icon icon-add"></i>
            </a>
        </header>*@
    <section class="jq22-scrollView">
        <div class="m-slider" data-ydui-slider>
            <div class="slider-wrapper">
                @foreach (var item in SlideShowList)
                {
                    <div class="slider-item">
                        @{
                            var link = item.Link_to;
                            if (ViewBag.IsWeiXin)
                            {
                                if (item.IsTKl.HasValue && item.IsTKl.Value)
                                {

                                    link = "/Mobile/SlideDetails?id="+ item.Id;
                                }

                            }
                            else
                            {

                            }
                        }
                        <a href="@link" target="_blank">
                            <img src="@Html.ImgSrc(item.Img_Src,AdminSite)" alt="">
                        </a>
                    </div>
                }
                @*<div class="slider-item">
                        <a href="javascript:;">
                            <img src="/Content/Mobile/images/ad-002.png" alt="">
                        </a>
                    </div>
                    <div class="slider-item">
                        <a href="javascript:;">
                            <img src="/Content/Mobile/images/banner2.png" alt="">
                        </a>
                    </div>*@

            </div>
            <div class="slider-pagination"></div>
        </div>
        <div class="jq22-palace">
            @foreach (var item in AppBarMobileList)
            {
                <a href="@item.Link" target="_blank" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="@Html.ImgSrc(item.Icon_S,AdminSite)" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>@item.Name</h2>
                    </div>
                </a>
            }
            @*<a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-001.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>签到福利</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-002.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>排行榜</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-003.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>百科</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-004.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>海淘</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-005.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>众测</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-006.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>白菜专区</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-007.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>优惠券</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-008.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>优惠日历</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-009.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>经验</h2>
                    </div>
                </a>
                <a href="javascript:;" class="jq22-palace-grid">
                    <div class="jq22-palace-grid-icon">
                        <img src="/Content/Mobile/images/nav-010.png" alt="">
                    </div>
                    <div class="jq22-palace-grid-text">
                        <h2>分类导航</h2>
                    </div>
                </a>*@
        </div>
        <div class="jq22-ad-img">
            <img src="@ViewBag.Ad_img" alt="">
        </div>
        <div class="divHeight"></div>
        <div class="jq22-good-list">
            @*@foreach (var item in MaterialList)
                {
                    <a href="@item.CouponClickUrl" class="jq22-flex">
                        <div class="jq22-img-pd">
                            <img src="@item.PictUrl" alt="">
                        </div>
                        <div class="jq22-flex-box">
                            <h2>@item.ShortTitle</h2>
                            <span>30日销量 @item.Volume</span>
                            <h3>券后  ￥@(decimal.Parse(item.ZkFinalPrice)- item.CouponAmount)</h3>
                            <p>点击领取 @(item.CouponAmount) 元优惠券</p>
                        </div>
                    </a>
                    <div class="divHeight"></div>
                }*@
            @*<a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-001.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>*@
            @*<a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-002.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-003.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-004.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>

                <div class="jq22-time-box">
                    <div class="jq22-cell-img">
                        <span><em>#</em>618学堂</span>
                        <img src="/Content/Mobile/images/ad-002.png" alt="">
                    </div>
                    <div class="jq22-time-title">
                        <h2>从4000到400000 2019年618家电影院投影机选购指南2019年618家电影院投影机选购指南</h2>
                    </div>
                    <div class="jq22-flex">
                        <div class="jq22-user-sml">
                            <img src="/Content/Mobile/images/user-logo-001.png" alt="">
                        </div>

                        <div class="jq22-flex-box">
                            <em>促销 <i class="icon icon-zun"></i></em>
                        </div>
                    </div>
                    <div class="divHeight"></div>
                </div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-005.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-006.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-007.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-008.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-009.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <div class="jq22-time-box">
                    <div class="jq22-cell-img">
                        <span><em>#</em>618实战</span>
                        <img src="/Content/Mobile/images/ad-003.png" alt="">
                    </div>
                    <div class="jq22-time-title">
                        <h2>从4000到400000 2019年618家电影院投影机选购指南2019年618家电影院投影机选购指南</h2>
                    </div>
                    <div class="jq22-flex">
                        <div class="jq22-user-sml">
                            <img src="/Content/Mobile/images/user-logo-002.png" alt="">
                        </div>

                        <div class="jq22-flex-box">
                            <em>促销 <i class="icon icon-zun"></i></em>
                        </div>
                    </div>
                    <div class="divHeight"></div>
                </div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-010.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-001.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-002.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-003.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile//Content/Mobile/images/pd-004.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>
                <a href="javascript:;" class="jq22-flex">
                    <div class="jq22-img-pd">
                        <img src="/Content/Mobile/images/pd-005.png" alt="">
                    </div>
                    <div class="jq22-flex-box">
                        <h2>可口可乐（Coca-Cola） 雪碧柠檬味汽水碳酸饮料330ml*24听装瓶装整箱装 雪碧</h2>
                        <span>30日内最低价</span>
                        <h3>39.99元包邮 (双重优惠)</h3>
                        <p>聚划算|09:39</p>
                    </div>
                </a>
                <div class="divHeight"></div>*@
        </div>
        <div style="height:55px"></div>

    </section>
    @*<footer class="jq22-footer jq22-footer-fixed">
            <a href="javascript:;" class="jq22-tabBar-item jq22-tabBar-item-active">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-home"></i>
                </span>
                <span class="jq22-tabBar-item-text">首页</span>
            </a>
            <a href="javascript:;" class="jq22-tabBar-item ">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-news"></i>
                </span>
                <span class="jq22-tabBar-item-text">好价</span>
            </a>
            <a href="javascript:;" class="jq22-tabBar-item ">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-pic"></i>
                </span>
                <span class="jq22-tabBar-item-text">社区</span>
            </a>
            <a href="javascript:;" class="jq22-tabBar-item ">
                <span class="jq22-tabBar-item-icon">
                    <i class="icon icon-mine"></i>
                </span>
                <span class="jq22-tabBar-item-text">我的</span>
            </a>
        </footer>*@

</section>
@*</body>
    </html>*@
<script src="~/Scripts/Mobile/jquery.min.js"></script>
<script src="~/Scripts/Mobile/layer.js"></script>
<script src="~/Scripts/Mobile/slider.js"></script>
<script src="~/Scripts/template-web.js.js"></script>
<script type="text/html" id="tpl">
    {{each ResultList}}
    @*<li>
            {{$index}} ---- {{$value.Nick}}
        </li>*@
    <a href="/mobile/GoodsDetails?itemid={{$value.ItemId}}" class="jq22-flex">
        <div class="jq22-img-pd">
            <img src="{{$value.PictUrl}}" alt="">
        </div>
        <div class="jq22-flex-box">
            {{if($value.ShortTitle)}}
            <h2>{{$value.ShortTitle}}</h2>
            {{else}}
            <h2>{{$value.Title}}</h2>
            {{/if}}
            {{if($value.ItemDescription)}}
            <span>{{$value.ItemDescription}}</span>
            {{/if}}
            <h3>券后  ￥{{(($value.ZkFinalPrice-$value.CouponAmount)).toFixed(1)}}</h3>
            <p>可领取 {{$value.CouponAmount}} 元优惠券</p>
            <div class="btn-buy">
                <span class="tobuy">去购买</span>
                <span>{{$value.Volume}}已购</span>
            </div>
        </div>
    </a>
    {{/each}}
</script>
<script>
    $(function () {

        var mid = @(ViewBag.Mid);

        var page = 1;

        AjaxMaterialList(mid, 1);//加载默认第一页




        $('.jq22-scrollView').scroll(function () {
            var viewH = $(this).height(),//可见高度
                contentH = $(this).get(0).scrollHeight,//内容高度
                scrollTop = $(this).scrollTop();//滚动高度

            console.log(viewH + ',' + contentH + ',' + scrollTop);

            if (contentH - viewH - scrollTop == 0) {
                //$('.wrapper2-content').append("111111111111");
                page += 1;
                AjaxMaterialList(mid, page);
            }
        });


        function AjaxMaterialList(id, page) {

            $.ajax({
                url: '/Mobile/AjaxMaterialList',
                type: 'POST',
                dataType: 'json',
                data: { id: id, page: page },
                success: function (result) {
                    console.log(result);
                    //$(".wrapper2-content").eq(index).html("");
                    var html = template('tpl', { ResultList: result.ResultList })
                    //var container = $(".wrapper2-content").eq(index);
                    //container.innerHTML = html;
                    $(".jq22-good-list").append(html);
                },
                error: function (res) {
                    // 错误时处理逻辑
                }
            });


        }

    });
</script>
